package com.cx.service.admin.basic.impl;

import com.cx.dao.impl.ChainJKTDaoSupport;
import com.cx.service.RedisService;
import com.cx.service.admin.basic.ChainBasicPrivilegeManager;
import com.cx.service.admin.basic.ChainBasicUserManager;
import org.cx.entity.Page;
import org.cx.entity.PageData;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("chainBasicUserService")
public class ChainBasicUserService implements ChainBasicUserManager {

    @Resource(name = "chainJKTDaoSupport")
    private ChainJKTDaoSupport chainJKTDao;



    @Override
    public PageData findUserInfoByPhone(PageData pd) throws Exception {
        List<PageData> list = (List<PageData>) chainJKTDao.findForList("UserMapper.findUserByUserPhone", pd);
        return list.isEmpty()?null:list.get(0);
    }

    @Override
    public List<PageData> findUserDetail(PageData pd) throws Exception {
        List<PageData> list = (List<PageData>) chainJKTDao.findForList("UserMapper.findUserDetail", pd);
        return list;
    }

    @Override
    public List<PageData> findUserDetailPage(Page pg) {
        List<PageData> list = (List<PageData>) chainJKTDao.findForList("UserMapper.findUserDetailPage", pg);
        return list;
    }



    @Override
    public Integer insertUser(PageData pd) {

        Integer result  =(Integer) chainJKTDao.save("UserMapper.insertUser",pd);
        return result;
    }

    @Override
    public Integer updateUser(PageData pd) {
        Integer result  =(Integer) chainJKTDao.save("UserMapper.updateUser",pd);
        return result;
    }

    @Override
    public Integer saveExcelUser(List<PageData> list) {
        return (Integer) chainJKTDao.save("UserMapper.saveExcelUser",list);
    }

    @Override
    public List<PageData> findClerkDetailPage(Page pg) {
        List<PageData> list = (List<PageData>) chainJKTDao.findForList("UserMapper.findClerkDetailPage", pg);
        return list;
    }
}
